/* eslint-disable */
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const SIZE = 6;

export default new Vuex.Store({
  state: {
    scene: 0,
    up: false,
    down: false
  },
  actions: {
    prevScene ({ commit }) {
      commit('prevSceneMutation')
    },
    nextScene ({ commit }) {
      commit('nextSceneMutation')
    },
    slideUp ({ commit }) {
      commit('setUp', true)
      setTimeout(() => {
        commit('setUp', false)
      }, 100)
    },
    slideDown ({ commit }) {
      commit('setDown', true)
      setTimeout(() => {
        commit('setDown', false)
      }, 100)
    }
  },
  mutations: {
    prevSceneMutation (state) {
      if (state.scene > 0) state.scene --
    },
    nextSceneMutation (state) {
      console.log('===nextScene===')
      if (state.scene < SIZE) state.scene ++
    },
    setUp (state, up) {
      state.up = up
    },
    setDown (state, down) {
      state.down = down
    }
  }
})